-- Field script to allow special handling of option-clicked
-- words in ANY text field, whether locked or unlocked
--
-- Guy Kuo, University of Nevada School of Medicine
-- December 13, 1987
--
-- Use this script freely in your owns stacks but please retain the
-- credit line
--
-- Note from Dominus: I got this out of Steve Drazga’s amazing
-- <Developer Stack 1.1>. Friends, if you're doing HyperCard work,
-- then you want Steve’s stack. Send $5.00 (best deal around) to:
-- Steve Drazga
-- Box 388
-- Southampton, PA 18966
-- And tell him where you got the address.
On MouseWithin -- UNSOM technique by Guy Kuo, December 13, 1987
-- If the the option key is depressed, set the cursor to indicate
-- we are in a special mode. While the option key continues to be
-- depressed, and the mouse is within the target field, wait for
-- mouseDowns. If one occurs, Pick up the word by clicking at the
-- last MouseLoc twice and getting the selection.
-- If the selection is not empty, do something with it. In this demo,
-- we put it into another field. Finally, click outside of the field
-- to avoid looping. Hopefully, (-1,-1) is outside of all active
-- objects.
--
-- While editing such a field, entry of Optioned characters from
-- the keyboard no longer requires movement of the mouse outside of
-- the field. However, the optioned characters do not appear until
-- after the option key is released
if the OptionKey is down then
if the locktext of the target is true then
put true into DidUnlock
set locktext of target to false
else
put false into DidUnlock
end if
set the cursor to 2
repeat while (the OptionKey is down) and (item 1 of the rect of target <= item 1 of the mouseLoc) and (item 1 of the mouseLoc <= item 3 of the rect of target) and (item 2 of the rect of target <= item 2 of the mouseLoc) and (item 2 of the mouseLoc <= item 4 of the rect of target)
if the Mouse is down then
click at the MouseLoc
click at the ClickLoc
if the selection <> empty then
go card selection
end if
click at -1,-1
end if
end repeat
if DidUnlock then
set the locktext of the target to true
end if
end if
end MouseWithin
-- part 2 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=475 top=155 right=172 bottom=511
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Totalobjects
-- part 3 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=3 top=76 right=95 bottom=123
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Yourloc
-- part 4 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=2 top=121 right=139 bottom=127
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: yourinitloc
-- part 5 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=454 top=321 right=338 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: refresh objects
-- part 7 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=2 top=165 right=183 bottom=127
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: CurScore
-- part 8 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=2 top=215 right=233 bottom=127
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: MaxWeight
-- part 9 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=4 top=319 right=338 bottom=78
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Tools
----- HyperTalk script -----
on mouseUp
go card "!!useful stuff"
end mouseUp
-- part 10 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=1 top=21 right=51 bottom=162
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 12
-- text size: 24
-- style flags: 0
-- line height: 32
-- part name:
-- part 11 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=416 top=174 right=196 bottom=511
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 512
-- line height: 13
-- part name: Update
----- HyperTalk script -----
on mouseUp
set the lockscreen to true
put empty into card field "objectnames"
put the number of cards into top
put 1 into zing
go first card of bkgnd "Object"
repeat until the short name of this bkgnd is not "Object"
if the short name of this card is not "!!master object" then
put the short name of this card into nam
put nam into line zing of card field "objectnames" of card "!globaldata"